package decorateMode.demo01;

/**
 * @author mubei
 * @date 2021/12/3
 * @description
 */
public class BufferReader_ extends Reader_{
    Reader_ decorated ;

    public BufferReader_(Reader_ decorated) {
        this.decorated = decorated;
    }


    public void fileReader(){
        this.decorated.fileReader();
        System.out.println("修饰一下FileReader");
    };
    public void stringReader(){
        this.decorated.stringReader();
        System.out.println("修饰一个StringReader");
    }

    @Override
    public void read() {
        decorated.read();
        if(decorated instanceof FileReader_){
            System.out.println("修饰fileReader_");
        }
        if(decorated instanceof StringReader_){
            System.out.println("装饰StringReader_");
        }

    }

    ;

}
